<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Time extends CI_Controller {

 
	function __construct()
	{
		parent::__construct();
		
		// check if user logged in 
		/*if (!$this->ion_auth->logged_in())
	  	{
			redirect('auth/login');
	  	}*/
		$this->load->model('user/user_model');
		$this->load->model('user/attendance_model');	
		$this->load->model('user/time_model');
		$this->load->model('ion_auth_model');	
			
	}
		
   function index()
   {
	   	$page = $this->session->flashdata('page');	
	   	$meta['page_title'] = "Time";			
		//echo '<pre>';
		//print_r($data);
		$data['get_entry_time'] = $this->time_model->get_entry_time($user);
		$this->load->model('user/time_model');	
		$this->load->view('common/header', $meta);   
	   	$this->load->view('user/time');
       	$this->load->view('common/footer');
   }
    function working_time($id=null)
	{
		
		if(isset($id))
		{
			$user= $id;
		}else
		{
			$user=$this->session->userdata('user_id');		
		}
		
		$date_id = date("d");
		$month_id = date("m");
		$year_id = str_replace('20','',date("Y"));	
		
		/*$date  = explode('-',$today);
		$date_id = $date[2];
		$month_id = $date[1];	
		$year_id = str_replace('20','',$date[0]);*/
	
		$data['userid'] = $user;
		$data['get_entry_time'] = $this->time_model->get_entry_time($user,$date_id,$month_id,$year_id);
		$meta['page_title'] = "Time";	
		$this->load->model('user/time_model');	
		$this->load->view('common/header', $meta);  
	   	$this->load->view('user/time',$data);
       	$this->load->view('common/footer');
	}
   
   }

	
	?>